package com.thiscc.sum.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.thiscc.sum.logic.GroupLogic;
import com.thiscc.sum.utils.ResponseUtils;

/**
 * 分组的控制类
 * @author DK
 * @createTime 2014.12.15
 * @since 1.0
 */

@Controller
@RequestMapping("group")
public class GroupController {
	
	@Autowired
	private GroupLogic groupLogic;
	
	/*-------------------------------------------------------------------------------------------*/
	
	/**
	 *	创建分组
	 * @param groupName //拿到分组的名称
	 * @param uuid //用户uuid
	 * @param leaguerUidd //组成员的uuid
	 * @author 易泉 2014-12-15 09:52:00 
	 */
	@RequestMapping("creatGroup")
	public void creatGroup(HttpServletRequest request, 
			HttpServletResponse response){
		
		String s_result = groupLogic.creatGroup(request);
		ResponseUtils.send(response, s_result);
	}
	
	/*-------------------------------------------------------------------------------------------*/
	/**
	 * 修改分组
	 * @param groupBeforeName //拿到修改前分组的名称
	 * @param groupAfterName //拿到修改后分组的名称
	 * @param uuid //用户uuid
	 * @author 易泉 2014-12-15 09:52:00 
	 */
	@RequestMapping("updateGroup")
	public void updateGroup(HttpServletRequest request, 
			HttpServletResponse response){
		
		String s_success = groupLogic.updateGroup(request);
		ResponseUtils.send(response, s_success);
	}
	
	/*---------------------------------------------------------------------------------*/
	
	/**
	 * 移除分组
	 * @param request
	 *              ccno 操作人的ccno
	 *              groupname 分组名
	 * @param response
	 * @author DK
	 */
	@RequestMapping("delGroup")
	public void delGroup(HttpServletRequest request,
			HttpServletResponse response){
		
		String result = groupLogic.delGroup(request);
		ResponseUtils.send(response, result);
	}
	
	/*----------------------------------------------------------------------------------*/
	/**
	 * 置顶
	 * @param request
	 *              uuid 操作人的uuid
	 *              groupname 被操作的组名
	 * @param response
	 * @author DK
	 * @createTime 2014-12-23
	 */
	@RequestMapping("putMost")
	public void putMost(HttpServletRequest request,
			HttpServletResponse response){
		
		String s_result = groupLogic.putMost(request);
		ResponseUtils.send(response, s_result);
	}
}
